#ifndef SM2_SM3_H
#define SM2_SM3_H

#include <stdint.h>

typedef struct {
    unsigned int state[8];
    unsigned char buf[64];
    uint64_t cur_buf_len; // bytes
    uint64_t compressed_len; // bits
} gm_sm3_context;

void gm_sm3_init(gm_sm3_context* ctx);

// append data
void gm_sm3_update(gm_sm3_context* ctx, const unsigned char* input, unsigned int iLen);

// output = digest
void gm_sm3_done(gm_sm3_context* ctx, unsigned char output[32]);

#endif//SM2_SM3_H
